<template>
  <el-header class="header-bar">
    <div class="left">
      <el-input
        v-model="search"
        placeholder="全局搜索"
        class="search-input"
      />
    </div>
    <div class="right">
      <el-dropdown>
        <span class="el-dropdown-link">
          <el-avatar icon="el-icon-user-solid" /> admin <i class="el-icon-arrow-down el-icon--right" />
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item @click="logout">
              退出登录
            </el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </el-header>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const search = ref('')
const router = useRouter()
function logout() {
  router.replace('/login')
}
</script>
<style scoped>
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  box-shadow: 0 2px 8px #f0f1f2;
  padding: 0 24px;
  height: 60px;
}
.left { flex: 1; }
.right { display: flex; align-items: center; }
.search-input { width: 220px; }
</style> 